#!/usr/bin/python

from hips import appengine_unittest
from datetime import datetime
import unittest

from google.appengine.api import users
from google.appengine.ext import db

from hips import datastore_mocks
from hips import translator


class TranslatorTestCase(appengine_unittest.AppEngineTest):
  """Tests that models round-trip properly through serialization."""

  def testCreateHipsSchedulingProblem(self):
    ds_schedule = datastore_mocks.CreateSchedule()
    ds_schedule.put()
    ds_schedule_blocks = []
    for i in range(30):
      block = datastore_mocks.CreateScheduleBlock(
          schedule=ds_schedule, start_time=datetime(2009, 6, i + 1),
          duration_minutes=24 * 60)
      block.put()
      ds_schedule_blocks.append(block)
    ds_constraints = []
    for i in range(6):
      constraint = datastore_mocks.CreateDoctorConstraint(
          schedule=ds_schedule)
      constraint.put()
      ds_constraints.append(constraint)
    problem = translator.CreateHipsSchedulingProblem(
        ds_schedule, ds_schedule_blocks, ds_constraints)
    self.assertTrue(problem)


if __name__ == '__main__':
  unittest.main()
